package org.opens.service;

import org.opens.entity.Product;
import org.opens.service.fallback.ProductServiceFallback;
import org.opens.service.fallback.ProductServiceFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * 说明:
 * <pre>
 *     1. @FeignClient(value = "service-product")注解的value属性就是来配置nacos中的serivceid的, 也就是其他服务的spring.application
 *     .name属性;
 * </pre>
 */
@FeignClient(
        value = "service-product"
        //, fallback = ProductServiceFallback.class
        , fallbackFactory = ProductServiceFallbackFactory.class
)
public interface ProductService {

    @RequestMapping(value = "/api/product/{id}")
    public Product findById(
            @PathVariable(value = "id") Integer id
    );

}
